<%@ page language="java" import="java.util.*,com.ruohi.util.common.*" pageEncoding="UTF-8"%><%
	String tableName = "service_schedule";
	String fileds = "id,uuid,schedule_type,http_url,is_use,name";
	String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
	Map channelMap = (Map)application.getAttribute("channelMap");
	String whereStr = " and channel_uuid = '"+channelUUID+"' ";
	String orderByStr = " id desc ";
	LinkedHashMap scheduleTypeMap = (LinkedHashMap)CommonApplication.getEnumChildren("104",application);
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title><%=Env.getInstance().getProperty("project_name")%></title>
		<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css"
			rel="stylesheet" type="text/css" />
		<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css"
			rel="stylesheet" type="text/css" />
		<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css"
			rel="stylesheet" type="text/css" />
		<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
		<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
	</head>
	<body>
		<div class="searchForm">
			<div class="searchCondition">
				<div class="searchList">
					<div class="searchLeft">
						调度类型
					</div>
					<div class="searchRight">
						<select class="jr_select" name="schedule_type" id="schedule_type">
							<option value="">--请选择调度类型--</option>
							<%=CommonForm.createSelect(scheduleTypeMap,"") %>
						</select>
					</div>
				</div>
				<div class="searchList">
					<div class="searchLeft">
						调度名称
					</div>
					<div class="searchRight">
						<input type="text" style="width: 100px;" class="jr_text" name="name" id="name" />
					</div>
				</div>
			</div>
			<div class="searchBtn">
				<input type="button" class="btn" onclick="doSearch();" value="查询" style="margin-right: 5px;" />
				<input type="button" class="btn" onclick="doClearForm();" value="重置" />
			</div>
		</div>
		<div style="clear: left;"></div>

		<div class="l-loading" style="display: block" id="pageloading"></div>
		<div id="maingrid" style="margin: 0; padding: 0"></div>
		<div style="display: none;">
			<input type="hidden" name="channel_uuid" id="channel_uuid"
				value="<%=channelUUID%>" />
		</div>
	</body>
</html>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js"
	type="text/javascript"></script>
<script src="/backend/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
	var grid;
	var windowWidth = 700;
	var windowHeight = 170;
	var channelUUID = '<%=channelUUID %>';
	var tableName = "<%=tableName%>";
	var fields = "<%=fileds%>";
	var whereStr = "<%=whereStr%>";
	var orderBy = "<%=orderByStr%>";
	var columnsArr = [];
	var url = "";
	var conditionStr = "";
	var params = [];
	jQuery(function() {
		grid = new Dev21sunGrid({
			toolbar : {
				items : [{
							text : '增加',
							click : function(){
								addAndEdit();
							},
							icon : 'add'
						}, {
							text : '删除',
							click : function(){
								toolbarDel({
									channel_uuid:'<%=channelUUID%>'
								});
							},
							icon : 'delete'
						}, {
							text : '调度刷新',
							click : function(){
								if(confirm("确定刷新调度吗？")){
									jQuery.post("/backend/action/after_own.jsp",{'eventAfter':'scheduler'},function(data){
										alert("调度刷新成功！");
									});
								}
							},
							icon : 'refresh'
						}]
			}
		});
		jQuery("#pageloading").hide();
	});
	//列数组
	columnsArr =  [
		{ display : '调度名称', name : 'name', align : 'left' , type : 'string' , width : 200 ,render : function(row){
				return "<a class='link' href='javascript:void(0);' onclick='addAndEdit("+row.__index+");'>"+row.name+"</a>";
			}
		} ,
		{ display : '调度类型', name : 'schedule_type', align : 'left' , type : 'string' , width : 200 , render : function(row){
				return getEnum(row.schedule_type);
			}
		} ,
		{ display : '是否使用', name : 'is_use', align : 'center' , type : 'is' , width : 200 } 
	];

	/*列表页条件查询*/
	function doSearch(){
		params = [];
		conditionStr = "";
		var schedule_type = jQuery("#schedule_type").val();
		if(''!=jQuery.trim(schedule_type)){
			conditionStr += " and schedule_type = '"+schedule_type+"' ";
		}
		var name = jQuery("#name").val();
		if(''!=jQuery.trim(name)){
			conditionStr += " and name like '%"+name+"%' ";
		}
		params.push({'name':'tableName','value':tableName});
		params.push({'name':'fileds','value':fields});
		params.push({'name':'whereStr','value':whereStr+conditionStr});
		params.push({'name':'orderBy','value':orderBy});
		grid.options.parms=params;
		grid.loadData();
	}
	
</script>